package com.definity.toolkit.i18n;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

public final class I18nManager {

	private static I18nManager instance;
	private final Map<String, I18n> messages;
	
	private I18nManager() {
		messages = new HashMap<String, I18n>();
	}
	
	static synchronized I18nManager getInstance() {
		if (instance == null) {
			instance = new I18nManager();
		}
		return instance;
	}
	
	public void add(String name, I18n i18n) {
		messages.put(name + Locale.getDefault().toString(), i18n);
	}
	
	public I18n get(String name) {
		return messages.get(name + Locale.getDefault().toString());
	}

	public void remove(String name) {
		messages.remove(name + Locale.getDefault().toString());
	}
	
}
